package com.aube.model;

import com.huyn.baseframework.model.VideoDefinition;
import com.huyn.baseframework.model.VideoPlayModel;
import com.huyn.baseframework.model.VideoWithDefinitionModel;
import com.huyn.baseframework.utils.StringUtils;

import java.io.Serializable;

/**
 * Created by huyaonan on 16/7/5.
 */
public class VrItemDetail implements Serializable {

    public String videoid;
    public String videono;
    public String videoDesc;
//    public int duration;

    public String leftRightAngle;
    public String updownAngle;

    public VideoWithDefinitionModel videoPlay;

    public VideoPlayModel getVideo() {
        VideoPlayModel model = new VideoPlayModel();
        model.videoId = videoid;
        model.videoNo = videono;
        model.videoModel = videoPlay;
        return model;
    }

    public boolean isLegal() {
        if(StringUtils.isNotBlank(videono))
            return true;
        if(videoPlay != null && videoPlay.definitions != null) {
            VideoDefinition definition  = videoPlay.getByIndex(0);
            if(definition != null && StringUtils.isNotBlank(definition.playurl))
                return true;
        }
        return false;
    }

}
